#REF! displayed when sorting list left to right due to invalid references.
Cause:
This problem occurs because one field in the list refers to another field. By sorting the fields, Excel loses the references.
Solution:
Undo the sort first to restore the original list. Change all the references to absolute or sort the list from top to bottom instead of left to right.